/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-04-01
 * Time: 9:35
 */
class NameException extends Exception{
    public NameException(String message) {
        super(message);
    }
}
class PasswordException extends Exception{
    public PasswordException(String message) {
        super(message);
    }
}
public class Login {
    private String name = "amy";
    private String password = "12345";

    public String getName() {
        return name;
    }

    public String getPassword() {
        return password;
    }

    public static void loginInfo(String name, String password) throws NameException, PasswordException{
        if(!name.equals(name)){
            throw new NameException("用户名错误");
        }
        if(!password.equals(password)){
            throw new PasswordException("密码错误");
        }
    }

    public static void main(String[] args) {
        try {
            loginInfo("amy","12346");
        } catch (NameException e) {
            e.printStackTrace();
        } catch (PasswordException e){
            e.printStackTrace();
        }
    }

}
